<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@page import="com.framework.entity.Global"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html>
<html class="no-js">
<head>
<meta charset="UTF-8">
<title>全部订单</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="format-detection" content="telephone=no">
<meta name="renderer" content="webkit">
<meta http-equiv="Cache-Control" content="no-siteapp" />
<jsp:include page="/jsp/inc_head.jsp"></jsp:include>
<style>
[data-am-widget=tabs] {
	margin: 0;
}
#zhezhao{
    background:#333;
    bottom: 0;
	width:100%;
    display: none;
    left: 0;
    opacity: 0.9;
    position: fixed;
    right: 0;
    top: 0;
    z-index: 1000;
	}
	.zzcltext{
    position: fixed;
    z-index: 1001;
    background: #fff;
    top: 30%;
    left: 50%;
    margin-left: -100px;
    width: 200px;
    height: 40px;
    text-align: center;
    border-radius: 10px;
    line-height: 40px;
}
.am-tabs-bd {
	border: none;
	margin-top: 2px;
}
.fwfspan{
	color:#acacac;
	font-size: 12px;
}
.am-tabs-default .am-tabs-nav a {
	color: #ffc9c9;
	line-height: 42px;
	background-color:#ff5d0e;
	font-size: 15px;
}

.am-tabs-default .am-tabs-nav>.am-active a {
	background-color: #ff5d0e;
	color: #fff;
}

.am-tabs-bd .am-tab-panel {
	padding: 0;
}
</style>
</head>
<body style="padding-top:43px;">
	<section class="am-g">
		<div data-am-widget="tabs" class="am-tabs am-tabs-default"
			data-am-tabs-noswipe="1">
			<ul class="am-tabs-nav am-cf goodsListTabUl" style="top:0;">
				<li id="tab_all" class="<c:if test="${param.state == ''}"> am-active</c:if>"><a href="[data-tab-panel-0]">全部</a></li>
				<li id="tab_0" class="<c:if test="${param.state == 0}"> am-active</c:if>"><a href="[data-tab-panel-1]">待付款</a></li>
				<li id="tab_1" class="<c:if test="${param.state == 1}"> am-active</c:if>"><a href="[data-tab-panel-2]">待收货</a></li>
				<li id="tab_4" class="<c:if test="${param.state == 2}"> am-active</c:if>"><a href="[data-tab-panel-3]">已完成</a></li>
				<li id="tab_5" class="<c:if test="${param.state == 3}"> am-active</c:if>"><a href="[data-tab-panel-4]">退款售后</a></li>
			</ul>
			<div class="am-tabs-bd">
				<div data-tab-panel-0 class="am-tab-panel <c:if test="${param.state == ''}"> am-active</c:if>" id="orderTotal">

				</div>
				<div data-tab-panel-1 class="am-tab-panel <c:if test="${param.state == 0}"> am-active</c:if>" id="orderList_1">

				</div>
				<div data-tab-panel-2 class="am-tab-panel <c:if test="${param.state == 1 }"> am-active</c:if>" id="orderList_2">

				</div>
				<div data-tab-panel-3 class="am-tab-panel <c:if test="${param.state == 2 }"> am-active</c:if>" id="orderList_3">
				
				</div>
				<div data-tab-panel-4 class="am-tab-panel <c:if test="${param.state == 3 }"> am-active</c:if>" id="orderList_4">
				</div>
			</div>
		</div>
	</section>
	
	<div id="zhezhao">
	<div class="zzcltext">
    	正在处理，请稍等。。。。
    </div>
    </div>
	
	<jsp:include page="/jsp/inc_bottom.jsp"></jsp:include>
	<script>
		var ajaxpath = "${pageContext.request.contextPath}";
		var page = 0;
		$("#orderTotal").html("");
		$(function() {
			loadOrders();
		});
		function loadOrders() {
			var url = ajaxpath + '/order/loadMyOrderList.do?page=' + page
					+ '&state=';
			$
					.get(
							url,
							function(result) {

// 								var htmlArray0 = [];
								var data = eval(result);
// 								alert($(data).length);
								$(data)
										.each(
												function(i) {
													var htmlSwith = 0;
													var tuikuanSwith = 0;
													var html = '';//商品信息
													var htmlBeg = '';//订单信息头
													var htmlEnd = '';//订单信息尾
													var orderState = '';//订单头状态分类
													var orderOperation = '<div class="am-fr am-padding-0 am-text-right">'
															+ '';//订单尾操作
													if(data[i].isClosed == 1){
															orderState = '<div class="am-u-sm-3 am-padding-0 am-text-right colgreen">已关闭</div>';
													}else{
														switch (data[i].state) {
														case 0:
															if(data[i].isPayCoupons == 1)
															{
																orderState = '<div class="am-fr am-padding-0 am-text-right colyellow">待付款</div>';//(已支付券点)
															}else if(data[i].isPayCoupons == 0){
																orderState = '<div class="am-fr am-padding-0 am-text-right colyellow">待付款</div>';//(未支付券点)
															}else{
																orderState = '<div class="am-fr am-padding-0 am-text-right colyellow">待付款</div>';
															}
															if(data[i].goodsType == '0')
															{
																orderOperation += '<div class="am-fr am-padding-0 am-text-right  am-margin-top-sm">';

															}else{
																orderOperation += '<div class="am-fr am-padding-0 am-text-right">';

															}
															orderOperation+= '<a class="am-btn am-btn-default qbddCzBtn" href="javascript:;" style="margin-right: 8px;" onclick="doCancel(\''
																	+ data[i].detailId
																	+ '\')">取消</a>'
																	+ '<a class="am-btn am-btn-default qbddCzBtn" href="javascript:;" onclick="doXinYePay(\''
																	+ data[i].code
																	+ '\')">付款</a></div>';
															htmlSwith = 1;
															break;
														case 1:
															orderState = '<div class="am-u-sm-3 am-padding-0 am-text-right colblue">待发货</div>';
															orderOperation = '<div class="am-fr am-padding-0 am-text-right">'
																	+ '<a class="am-btn am-btn-default qbddCzBtn" href="javascript:;" style="margin-right: 8px;"onclick="toRefund(\''
																	+ data[i].detailId
																	+ '\')">申请退款</a>'
																	+ '<a class="am-btn am-btn-default qbddCzBtn" href="tel:'+data[i].shopPhone+'">联系卖家</a></div>';
															htmlSwith = 2;
															break;
														case 2:
															orderState = '<div class="am-u-sm-3 am-padding-0 am-text-right colred">待收货</div>';
															orderOperation = '<div class="am-u-sm-12 am-padding-0 am-text-right" style="margin-top: 5px;">'
																	+ '<a class="am-btn am-btn-default qbddCzBtn" href="javascript:;" style="margin-right: 8px;" onclick="toHarvest(\''
																	+ data[i].detailId
																	+ '\')">确认收货</a>'
																	+ '<a class="am-btn am-btn-default qbddCzBtn" href="javascript:;" style="margin-right: 8px;" onclick="toRefund(\''
																	+ data[i].detailId
																	+ '\')">申请退款</a>'
																	+ '<a class="am-btn am-btn-default qbddCzBtn" href="tel:'+data[i].shopPhone+'">联系卖家</a></div>';
															htmlSwith = 2;
															break;
														case 3:
															orderState = '<div class="am-u-sm-3 am-padding-0 am-text-right colgreen">已完成</div>';
															htmlSwith = 3;
															break;
														case 4:
															orderState = '<div class="am-u-sm-3 am-padding-0 am-text-right colgreen">已完成</div>';
															htmlSwith = 3;
	
															break;
														case 5:
															orderState = '<div class="am-u-sm-3 am-padding-0 am-text-right coleee">退款审核</div>';
															orderOperation = '<div class="am-fr am-padding-0 am-text-right">'
																	+ '<a class="am-btn am-btn-default qbddCzBtn" href="javascript:;" onclick="toDelApplyDetail(\''
																	+ data[i].detailId
																	+ '\')"style="margin-right: 8px;">撤销申请</a>'
																	+ '<a class="am-btn am-btn-default qbddCzBtn" href="javascript:;"onclick="toRefundDetail(\''
																	+ data[i].detailId
																	+ '\')">退款详情</a></div>';
															htmlSwith = 4;
															tuikuanSwith = 0;
															break;
														case 6:
															orderState = '<div class="am-u-sm-3 am-padding-0 am-text-right colyellow">退款成功</div>';
															orderOperation = '<div class="am-fr am-padding-0 am-text-right">'
																	+ '<a class="am-btn am-btn-default qbddCzBtn" href="javascript:;" style="margin-right: 8px;"onclick="toRefundDetail(\''
																	+ data[i].detailId
																	+ '\')">退款详情</a></div>';
															htmlSwith = 4;
															tuikuanSwith = 1;
															break;
														case 7:
															orderState = '<div class="am-u-sm-3 am-padding-0 am-text-right colblue">待发货</div>';
															orderOperation = '<div class="am-fr am-padding-0 am-text-right">'
																	+ '<a class="am-btn am-btn-default qbddCzBtn" href="javascript:;" style="margin-right: 8px;"onclick="toRefund(\''
																	+ data[i].detailId
																	+ '\')">申请退款</a>'
																	+ '<a class="am-btn am-btn-default qbddCzBtn" href="tel:'+data[i].shopPhone+'">联系卖家</a></div>';
															htmlSwith = 2;
															break;
														case 8:
															orderState = '<div class="am-u-sm-3 am-padding-0 am-text-right colyellow">退款成功</div>';
															orderOperation = '<div class="am-fr am-padding-0 am-text-right">'
																	+ '<a class="am-btn am-btn-default qbddCzBtn" href="javascript:;" style="margin-right: 8px;"onclick="toRefundDetail(\''
																	+ data[i].detailId
																	+ '\')">退款详情</a></div>';
															htmlSwith = 4;
															tuikuanSwith = 1;
															break;
														case 9:
															orderState = '<div class="am-u-sm-3 am-padding-0 am-text-right colred">退款失败</div>';
															orderOperation = '<div class="am-fr am-padding-0 am-text-right">'
																	+ '<a class="am-btn am-btn-default qbddCzBtn" href="javascript:;" style="margin-right: 8px;"onclick="toRefundDetail(\''
																	+ data[i].detailId
																	+ '\')">退款详情</a>'
																	+ '<a class="am-btn am-btn-default qbddCzBtn" href="tel:'+data[i].shopPhone+'">联系卖家</a></div>';
															htmlSwith = 4;
															tuikuanSwith = 2;
															break;
														default:
															break;
														}
													}
													if(data[i].state == 0)//待付款
													{
														var goodsList = data[i].goodsList;
														var detail_coupssssssss = 0;
														var detail_payTotal = 0;
														if(goodsList!=undefined && goodsList.length>0)
														{
															for(var kk = 0; kk < goodsList.length; kk++)
															{
																var goodsDetail = goodsList[kk];
																if(data[i].goodsType == '0')
																{
																	if(goodsDetail.couponsPayTotal == undefined)
																	{
																		detail_coupssssssss += 0;
																	}else{
																		detail_coupssssssss += goodsDetail.couponsPayTotal;
																	}
																	detail_payTotal += goodsDetail.detailPayTotal;
																}else{
																	detail_payTotal += goodsDetail.detailPayTotal;
																}
																html += '<div class="am-u-sm-12 orderinfo">'
																		+ '<div class="am-u-sm-3 am-padding-0" onclick=toOrderDetails("'
																		+ goodsDetail.detailId
																		+ '","'
																		+ htmlSwith
																		+ '_'
																		+ tuikuanSwith
																		+ '");>';
																if(goodsDetail.mainType == '3')
																{
																	html+= '<img src="<%=Global.OSSURL_MAINTYPE3%>/'+goodsDetail.goodsPath+'" class="sptpimg" />';
																}else{
																	html+= '<img src="<%=Global.OSSURL%>/'+goodsDetail.goodsPath+'" class="sptpimg" />';
																}
																html+= '</div>'
																		+
																		//'<input name="goodsPaytotal'+data[i].id+'" value="'+data[i].detailPayTotal+'">'+
																		'<div class="am-u-sm-9 am-padding-0" onclick=toOrderDetails("'
																		+ goodsDetail.detailId
																		+ '","'
																		+ htmlSwith
																		+ '_'
																		+ tuikuanSwith
																		+ '");>'
																		+ '<div class="am-u-sm-12 am-padding-0 infoname">'
																		+ goodsDetail.goodsName
																		+ '</div>'
																		+ '<div class="am-u-sm-12 infogg">'
																		+ goodsDetail.typeValue1
																		+ ifnullString(goodsDetail.typeValue2)
																		+ ifnullString(goodsDetail.typeValue3)
																		+ '</div>'
																		+ '<div class="am-u-sm-12 am-padding-0" style="font-size:13px;">'
																		+ '<div class="am-u-sm-6 am-padding-0">X'
																		+ goodsDetail.count
																		+ '</div>';
																if(data[i].goodsType == '0')
																{
																	html+=' <div class="am-u-sm-6 am-padding-0 am-text-right">'
																			+ toDecimal2(goodsDetail.price)+'<span>券</span>';
																}else{
																	html+=' <div class="am-u-sm-6 am-padding-0 am-text-right">';
																	+ toDecimal2(goodsDetail.price)+'<span>元</span>';
																}
																html+='</div>'
																		+ ' </div></div></div>';
															}
														}else{
																html += '<div class="am-u-sm-12 orderinfo">'
																		+ '<div class="am-u-sm-3 am-padding-0" onclick=toOrderDetails("'
																		+ data[i].detailId
																		+ '","'
																		+ htmlSwith
																		+ '_'
																		+ tuikuanSwith
																		+ '");>';
																if(data[i].mainType == '3')
																{
																	html+= '<img src="<%=Global.OSSURL_MAINTYPE3%>/'+data[i].goodsPath+'" class="sptpimg" />';
																}else{
																	html+= '<img src="<%=Global.OSSURL%>/'+data[i].goodsPath+'" class="sptpimg" />';
																}
																html+= '</div>'
																		+
																		//'<input name="goodsPaytotal'+data[i].id+'" value="'+data[i].detailPayTotal+'">'+
																		'<div class="am-u-sm-9 am-padding-0" onclick=toOrderDetails("'
																		+ data[i].detailId
																		+ '","'
																		+ htmlSwith
																		+ '_'
																		+ tuikuanSwith
																		+ '");>'
																		+ '<div class="am-u-sm-12 am-padding-0 infoname">'
																		+ data[i].goodsName
																		+ '</div>'
																		+ '<div class="am-u-sm-12 infogg">'
																		+ data[i].typeValue1
																		+ ifnullString(data[i].typeValue2)
																		+ ifnullString(data[i].typeValue3)
																		+ '</div>'
																		+ '<div class="am-u-sm-12 am-padding-0" style="font-size:13px;">'
																		+ '<div class="am-u-sm-6 am-padding-0">X'
																		+ data[i].count
																		+ '</div>';
																if(data[i].goodsType == '0')
																{
																	html+=' <div class="am-u-sm-6 am-padding-0 am-text-right">'
																			+ toDecimal2(data[i].price)+'<span>券</span>';
																}else{
																	html+=' <div class="am-u-sm-6 am-padding-0 am-text-right">';
																	+ toDecimal2(data[i].price)+'<span>元</span>';
																}
																html+='</div>'
																		+ ' </div></div></div>';
														}
													}else{

														html = '<div class="am-u-sm-12 orderinfo">'
																+ '<div class="am-u-sm-3 am-padding-0" onclick=toOrderDetails("'
																+ data[i].detailId
																+ '","'
																+ htmlSwith
																+ '_'
																+ tuikuanSwith
																+ '");>';
														if(data[i].mainType == '3')
														{
															html+= '<img src="<%=Global.OSSURL_MAINTYPE3%>/'+data[i].goodsPath+'" class="sptpimg" />';
														}else{
															html+= '<img src="<%=Global.OSSURL%>/'+data[i].goodsPath+'" class="sptpimg" />';
														}
														html+= '</div>'
																+
																//'<input name="goodsPaytotal'+data[i].id+'" value="'+data[i].detailPayTotal+'">'+
																'<div class="am-u-sm-9 am-padding-0" onclick=toOrderDetails("'
																+ data[i].detailId
																+ '","'
																+ htmlSwith
																+ '_'
																+ tuikuanSwith
																+ '");>'
																+ '<div class="am-u-sm-12 am-padding-0 infoname">'
																+ data[i].goodsName
																+ '</div>'
																+ '<div class="am-u-sm-12 infogg">'
																+ data[i].typeValue1
																+ ifnullString(data[i].typeValue2)
																+ ifnullString(data[i].typeValue3)
																+ '</div>'
																+ '<div class="am-u-sm-12 am-padding-0" style="font-size:13px;">'
																+ '<div class="am-u-sm-6 am-padding-0">X'
																+ data[i].count
																+ '</div>';
														if(data[i].goodsType == '0')
														{
															html+=' <div class="am-u-sm-6 am-padding-0 am-text-right">'
																	+ toDecimal2(data[i].price)+'<span>券</span>';
														}else{
															html+=' <div class="am-u-sm-6 am-padding-0 am-text-right">';
															+ toDecimal2(data[i].price)+'<span>元</span>';
														}
														html+='</div>'
																+ ' </div></div></div>';
													}//其他订单

													htmlBeg = '<div class="am-u-sm-12 am-padding-0">'
															+ '<div class="am-u-sm-12 qbddDdhZt">'
															+ '<div class="am-fl qbddDdbh">订单编号 '
															+ data[i].code
															+ '</div>'
															+ orderState
															+ '</div>'
															+ '</div>'
															+ '<div class="am-u-sm-12 am-padding-0"  name="orderinfo'+data[i].code+'_'+htmlSwith+'_'+tuikuanSwith+'"  >';

													htmlEnd = ' </div>'
															+ '<div class="am-u-sm-12 qbddHjCzbtn">';
													if(data[i].state == 0)
													{
														if(data[i].goodsType == '0')
														{
															if(toDecimal2(data[i].coinPayTotal)>0)
															{
																htmlEnd += '<div class="am-fl am-padding-0 am-margin-top-xs">合计：<span class="colred11">'+toDecimal2(detail_coupssssssss)+'券</span><br/><span class="fwfspan">(含服务费'+toDecimal2(detail_payTotal)+'元,久零币抵扣'+toDecimal2(data[i].coinPayTotal)+'元)</span></div>';
															}else{
																htmlEnd += '<div class="am-fl am-padding-0 am-margin-top-xs">合计：<span class="colred11">'+toDecimal2(detail_coupssssssss)+'券</span><br/><span class="fwfspan">(含服务费'+toDecimal2(detail_payTotal)+'元)</span></div>';
															}
														}else{
															if(toDecimal2(data[i].coinPayTotal)>0) {
																htmlEnd += '<div class="am-fl am-padding-0 am-margin-top-xs">合计：<span class="colred11">'+toDecimal2(detail_payTotal)+'元,久零币抵扣'+toDecimal2(data[i].coinPayTotal)+'元</span><span class="fwfspan"></span></div>';
															}else{
																htmlEnd += '<div class="am-fl am-padding-0 am-margin-top-xs">合计：<span class="colred11">' + toDecimal2(detail_payTotal) + '元</span><span class="fwfspan"></span></div>';
															}
														}
													}else{
														if(data[i].goodsType == '0')
														{
															var coupssssssss = 0;
															if(data[i].couponsPayTotal == undefined)
															{
																coupssssssss = 0;
															}else{
																coupssssssss = data[i].couponsPayTotal;
															}
															if(toDecimal2(data[i].coinPayTotal)>0) {
																htmlEnd += '<div class="am-fl am-padding-0 am-margin-top-xs">合计：<span class="colred11">' + toDecimal2(coupssssssss) + '券</span><br/><span class="fwfspan">(含服务费' + toDecimal2(data[i].detailPayTotal) + '元,久零币抵扣' + toDecimal2(data[i].coinPayTotal) + '元)</span></div>';
															}else{
																htmlEnd += '<div class="am-fl am-padding-0 am-margin-top-xs">合计：<span class="colred11">'+toDecimal2(coupssssssss)+'券</span><br/><span class="fwfspan">(含服务费'+toDecimal2(data[i].detailPayTotal)+'元)</span></div>';
															}
														}else{
															if(toDecimal2(data[i].coinPayTotal)>0) {
																htmlEnd += '<div class="am-fl am-padding-0 am-margin-top-xs">合计：<span class="colred11">'+toDecimal2(data[i].detailPayTotal)+'元,久零币抵扣' + toDecimal2(data[i].coinPayTotal) + '元</span><span class="fwfspan"></span></div>';
															}else{
																htmlEnd += '<div class="am-fl am-padding-0 am-margin-top-xs">合计：<span class="colred11">'+toDecimal2(data[i].detailPayTotal)+'元</span><span class="fwfspan"></span></div>';
															}
														}
													}

// 													if (data[i].state == 0) {
														htmlEnd += orderOperation;
// 													} else {
// 														html += orderOperation;
// 													}
													html += '</div>';
													htmlEnd += '</div></div>';
														$("#orderTotal")
																.append(
																		htmlBeg
																				+ html
																				+ htmlEnd);
// 																				alert(orderState);
														if (orderState != 0) {
// 															alert(htmlSwith);
															$(
																	"#orderList_"
																			+ htmlSwith)
																	.append(
																			htmlBeg
																					+ html
																					+ htmlEnd);
														}
// 														htmlArray0.push(save);
// 													}
												});
							});
		}

		function toRefund(id) {
			location.href = ajaxpath + "/order/toOrderRefund.do?orderId=" + id;
		}
		
		function toRefundDetail(id) {
			location.href = ajaxpath + "/order/toRefundDetail.do?id=" + id;
		}
		function toOrderDetails(id, type) {
			location.href = ajaxpath + "/order/toOrderDetails.do?id=" + id
					+ "&type=" + type;
		}

		function accAdd(arg1, arg2) { //浮点数运算加法
			var r1, r2, m;
			try {
				r1 = arg1.toString().split(".")[1].length;
			} catch (e) {
				r1 = 0;
			}
			try {
				r2 = arg2.toString().split(".")[1].length;
			} catch (e) {
				r2 = 0;
			}
			m = Math.pow(10, Math.max(r1, r2));
			return (arg1 * m + arg2 * m) / m;
		}

		function toDecimal2(x) {
			var f = parseFloat(x);
			if (isNaN(f)) {
				return false;
			}
			var f = Math.round(x * 100) / 100;
			var s = f.toString();
			var rs = s.indexOf('.');
			if (rs < 0) {
				rs = s.length;
				s += '.';
			}
			while (s.length <= rs + 2) {
				s += '0';
			}
			return s;
		}

		/*****加载商品信息--------开始****************/
		/** 下拉时调用 再次加载 8 条商品*/
//		$(window).scroll(
//				function() {
//					if (($(window).scrollTop() + $(window).height() >= $(
//							document).height() - 50)) {
//						page++;
//						loadOrders();
//					}
//				});

		function ifnullString(stringpd) {
			if (stringpd == null) {
				return '';
			} else {
				return ',' + stringpd;
			}
		}
		
		
		//付款(假付款)
		function payorder(codes) {
			/* var payCodes = 'ceshi';
			 $.ajax({
				url : ajaxpath + '/orderPay/toPayOrder.do',
				type : 'post',
				data : {
					codes : codes,
					payCodes : payCodes
				},
				dataType : "json",
				success : function(data) {
					window.location.href = ajaxpath+"/jsp/order/orderList.jsp?guid="+ new Date(); 
				}
			});  */
			}

//兴业银行支付
		function doXinYePay(ordercodeArr){
		$("#zhezhao").css("display","block");//遮罩层
		$.ajax({
				url : ajaxpath + '/payBank/toPayBankOrder.do',
				type : "post",
				data : {
					ordercodeArr : ordercodeArr,
					attach : 0
				},
				dataType : "json",
				success : function(data) {
					$("#zhezhao").css("display","none");//遮罩层
					if(data.result){
						window.location.href ="https://pay.swiftpass.cn/pay/jspay?token_id="+data.msg+"&showwxtitle=1";
					}else{
						alert(data.msg);
						window.location.href = ajaxpath
							+ "/client_toClientCenter.do";
					}
					
				}
			});
			
		}
		
		
		//确认收货
		function toHarvest(did)
		{
		if(did==null || did==undefined || did=='')
		{
		return ;
		}
		$.ajax({
				url : ajaxpath + '/order/toOrderHarvest.do',
				type : 'post',
				data : {
					detailid : did
				},
				dataType : "json",
				success : function(data) {
					window.location.href = ajaxpath+"/jsp/order/orderList.jsp?guid="+ new Date(); 
				}
			}); 
		}

		function doCancel(detailId)
		{
			if(detailId==null || detailId==undefined || detailId=='')
			{
				return ;
			}
			if(confirm("您确定取消该订单吗？")==true)
			{
				$.ajax({
					url : ajaxpath+'/order/doCancel.do',
					type : 'post',
					data : {
						detailId : detailId
					},
					dataType : "json",
					success : function(data) {
						window.location.href = ajaxpath+"/jsp/order/orderList.jsp?guid="+ new Date();
					}
				});
			}
		}

		//撤销
		function toDelApplyDetail(did)
		{
		if(did==null || did==undefined || did=='')
		{
		return ;
		}
		$.ajax({
				url : ajaxpath+'/order/clearRefund.do',
				type : 'post',
				data : {
					id : did
				},
				dataType : "json",
				success : function(data) {
					window.location.href = ajaxpath+"/jsp/order/orderList.jsp?guid="+ new Date(); 
				}
			}); 
		}
		
	</script>
</body>
</html>


